<template>

	<view class="main-box">
		
		<view class="times">
			<roll-up-mobiles></roll-up-mobiles>
		</view>
		<image @click="toTopMethod" class="bg" mode="widthFix" :src="rootImagePath + 'bg.png'"
			style="pointer-events: none">
		</image>
		<image @click="gotoReceive" class="receive-btn" mode="widthFix" :src="rootImagePath + 'receive-btn.png'"
			style="pointer-events: none">
		</image>
		<view class="forms">
			<submit-forms :param="props.param" :autoSubmit="autoSubmit" :mobile="props.mobile"
				:rootImagePath="rootImagePath"></submit-forms>
<view class="" style="margin-top: 360rpx;width: 100%;">
	<view class="foot-tip-text">业务资费：连续包月29.9元/月(可随时取消)）</view>
	<view class="foot-tip-text">29.9元=优酷视频会员月卡+30元支付宝立减金</view>
	<view class="foot-tip-text">客服热线:400-8825010</view>
</view>

		</view>


	</view>
	<goto-form-fix-btn :targetId="scrollToTargetId" :rootImagePath="rootImagePath"></goto-form-fix-btn>
	<right-fix-box :rootImagePath="rootImagePath"></right-fix-box>
</template>

<script setup>
	import VueScrollTo from "vue-scrollto"
	import {
		onMounted,
		ref
	} from "vue";
	import httpUtil from "@/utils/httpUtil.js"
	import deviceUtil from "@/utils/deviceUtil.js"
	import userApi from "@/apis/userApi.js"
	import aliApi from "@/apis/aliApi";
	import commonApi from "@/apis/commonApi.js"
	import md5 from "@/utils/md5.js"
	import validParamsUtil from "@/utils/validParamsUtil";
	import logApi from "@/apis/logApi";
	import paramApi from "@/apis/paramApi.js"

	const rootImagePath = "https://web.78keji.cn/images/xiaowu/newyks/cdq/"

	const scrollToTargetId = ref('form-box')
	const scrollData = ref(0);

	const props = defineProps(['a', 'param', 'code', 'openid',
		'from_wxpay', 'openidHF', 'mobile', 'autoSubmit',
		'push_id', 'pushid', 'clickid', 'tokenid', 'adId', 'jtcAdRequestId',
		'qcjParamStr'
	])

	onMounted(() => {
		// 监听滚动条位置
		// window.addEventListener("scroll", scrollTopMethod, true);
		// setTimeout(() => {
		// 	toTopMethod();
		// }, 1000)
		// if (props.a) {
		// 	httpUtil.setA(props.a)
		// }
		initData()
	})

	const initData = () => {
		var s = [];
		var hexDigits = "0123456789abcdef";
		for (var i = 0; i < 36; i++) {
			s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
		}
		s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
		s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
		s[8] = s[13] = s[18] = s[23] = "-";

		var uuid = s.join("");
		uni.setStorageSync('uuid', uuid)
		paramApi.clearParam()
		paramApi.initData(props)
		let params = {
			a: httpUtil.getA(),
			proCode: 'LH2506',
			uuid: uni.getStorageSync('uuid')
		}
		httpUtil.post('/api/tongji/tongji0520', params, res => {


		})
		commonApi.is404()

		// #ifdef H5

		if (deviceUtil.isWeChatBrowser()) {
			// 用户没有userId 就获取
			if (!userApi.getUserId() && !props.code) {
				userApi.gotoH5WxPlatformLoginUrl()
			}
			if (!userApi.getUserId() && props.code) {
				userApi.initUserId(props.code)
			}
			// 支付宝浏览器登录
		} else if (deviceUtil.isAliBrowser() && !userApi.getUserId()) {
			aliApi.getAliUserIdMethod()
		}

		// #endif
		// #ifdef MP
		initMiniData()
		// #endif
		// checkOrderStatus()
		commonApi.buriedPoint()
	}




	const initMiniData = () => {
		userApi.getMiniLoginCode(code => {
			userApi.initUserId(code)
		})
	}
	const scrollTopMethod = () => {
		scrollData.value = document.documentElement.scrollTop || document.body.scrollTop;
	}

	const toTopMethod = () => {
		console.log('toTopMethod', scrollToTargetId.value)
		let offset = document.documentElement.clientHeight / 2 - 100;
		VueScrollTo.scrollTo(document.getElementById(scrollToTargetId.value), 1000, {
			offset: -offset,
		});
	}

	const gotoReceive = () => {
		window.location.href =
			'https://shop118429696.m.youzan.com/v2/feature/aUVgJC8JZb?shopAutoEnter=1&kdt_id=118237528'
	}
</script>

<style lang="scss">
	.foot-tip-text {
		
		font-size: 24rpx;
		text-align: center;
		font-family: SourceHanSansSC-Light;
		
		margin: 10rpx auto 0;
	}

	.main-box {
		position: relative;
		min-height: 100vh;
	

	}

	.bg {
		width: 100%;
		display: block;
	}

	.receive-btn {
		width: 200rpx;
		height: 50rpx;
		display: block;
		position: absolute;
		left: 80rpx;
		top: 112vw;

	}

	.forms {
		position: absolute;
		top: 850rpx;
		left: 100rpx;
	
	}
	.times{
		z-index: 1;
		position: absolute;
		top: 730rpx;
		left: 170rpx;
	}
</style>